#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n = 0;
    while (cin >> n) {
        vector<int> nums(n);
        for (int i = 0; i < n; ++i) {
            int num = 0;
            cin >> num;
            nums[i] = num;
        }
        vector<int> dp(n);
        dp[0] = 1;
        int curMaxDpVal = dp[1];
        for (int i = 1; i < n; ++i) {
            if (nums[i] > nums[i - 1]) {
                dp[i] = dp[i - 1] + 1;
            } else {
                int curMaxDp = 0;
                for (int j = i - 1; j >= 0; --j) {
                    if (nums[j] < nums[i] && dp[j] > curMaxDp) {
                        curMaxDp = dp[j] + 1;
                    }
                }
                dp[i] = curMaxDp;
            }
            curMaxDpVal = max(curMaxDpVal, dp[i]);
        }
        //cout << curMaxDpVal << endl;
    	for(auto e : dp) {
   		cout << e << ' ';
    	}
    	cout << endl;
    }
    return 0;
}
